export default {
  get: function (key) {
    return sessionStorage['cache-' + key];
  },
  getObj: function (key) {
    if (sessionStorage['cache-' + key]) {
      try {
        return JSON.parse(sessionStorage['cache-' + key]);
      } catch (e) {
        console.log(e);
      }
    }

    return undefined;
  },
  put: function (key, obj) {
    if (typeof (obj) == 'string') {
      sessionStorage['cache-' + key] = obj;
    } else {
      sessionStorage['cache-' + key] = JSON.stringify(obj);
    }
  }
}
